package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.EmploymentTrackingStudent;
import com.ruoyi.system.service.IEmploymentTrackingStudentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 就业追踪Controller
 *
 * @author luofan
 * @date 2024-11-17
 */
@RestController
@RequestMapping("/system/EmploymentTrackingStudent")
public class EmploymentTrackingStudentController extends BaseController
{
    @Autowired
    private IEmploymentTrackingStudentService employmentTrackingStudentService;

    /**
     * 查询就业追踪列表
     */
    @PreAuthorize("@ss.hasPermi('system:EmploymentTrackingStudent:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmploymentTrackingStudent employmentTrackingStudent, @RequestParam(required = false) Long uid)
    {System.out.println("uid"+uid);
        startPage();
        List<EmploymentTrackingStudent> list = employmentTrackingStudentService.selectEmploymentTrackingStudentList(employmentTrackingStudent,uid);
        return getDataTable(list);
    }

    /**
     * 导出就业追踪列表
     */
//    @PreAuthorize("@ss.hasPermi('system:EmploymentTrackingStudent:export')")
//    @Log(title = "就业追踪", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, EmploymentTrackingStudent employmentTrackingStudent)
//    {
//        List<EmploymentTrackingStudent> list = employmentTrackingStudentService.selectEmploymentTrackingStudentList(employmentTrackingStudent);
//        ExcelUtil<EmploymentTrackingStudent> util = new ExcelUtil<EmploymentTrackingStudent>(EmploymentTrackingStudent.class);
//        util.exportExcel(response, list, "就业追踪数据");
//    }

    /**
     * 获取就业追踪详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:EmploymentTrackingStudent:query')")
    @GetMapping(value = "/{studentId}")
    public AjaxResult getInfo(@PathVariable("studentId") Long studentId)
    {
        return success(employmentTrackingStudentService.selectEmploymentTrackingStudentById(studentId));
    }

    /**
     * 新增就业追踪
     */
    @PreAuthorize("@ss.hasPermi('system:EmploymentTrackingStudent:add')")
    @Log(title = "就业追踪", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmploymentTrackingStudent employmentTrackingStudent)
    {
        return toAjax(employmentTrackingStudentService.insertEmploymentTrackingStudent(employmentTrackingStudent));
    }

    /**
     * 修改就业追踪
     */
    @PreAuthorize("@ss.hasPermi('system:EmploymentTrackingStudent:edit')")
    @Log(title = "就业追踪", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmploymentTrackingStudent employmentTrackingStudent)
    {
        return toAjax(employmentTrackingStudentService.updateEmploymentTrackingStudent(employmentTrackingStudent));
    }

    /**
     * 删除就业追踪
     */
    @PreAuthorize("@ss.hasPermi('system:EmploymentTrackingStudent:remove')")
    @Log(title = "就业追踪", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(employmentTrackingStudentService.deleteEmploymentTrackingStudentByIds(ids));
    }
}
